package EmailService;

import java.util.List;
import java.util.Properties;


public class SendInfo {

    // 发送邮件的服务器IP
    private String mailServerHost;
    // 发送邮件的服务器端口
    private String mailServerPort = "25";
    // 发送邮件的地址
    private String fromAddress;
    // 接收邮件的地址
    private List<String> toAddress;
    // 抄送邮件的地址
    private List<String> ccAddress;
    // 密送邮件的地址
    private List<String> bccAddress;
    // 登录邮件发送服务器的用户名和密码
    private String userName;
    private String userPassword;
    // 是否需要身份验证
    private boolean validate = false;
    // 邮件主题
    private String mailSubject;
    // 邮件内容
    private String mailContent;
    // 图片的文件名
    private List<String> attachImageNames;
    // 附件的文件名
    private List<String> attachFileNames;
    // 协议
    private String protocol = "smtp";

    /**
     * Properties是HashTable的子类，用于创建Session对象
     * @return 配置邮件信息的环境属性
     */
    public Properties getProperties(){
        Properties props = new Properties();
        props.put("mail.transport.protocol",this.protocol);
        props.put("mail.smtp.host",this.mailServerHost);
        props.put("mail.smtp.port",this.mailServerPort);
        props.put("mail.smtp.auth",validate ? "true" : "false");
        return props;
    }

    public String getMailServerHost() {
        return mailServerHost;
    }

    public void setMailServerHost(String mailServerHost) {
        this.mailServerHost = mailServerHost;
    }

    public String getMailServerPort() {
        return mailServerPort;
    }

    public void setMailServerPort(String mailServerPort) {
        this.mailServerPort = mailServerPort;
    }

    public String getFromAddress() {
        return fromAddress;
    }

    public void setFromAddress(String fromAddress) {
        this.fromAddress = fromAddress;
    }

    public List<String> getToAddress() {
        return toAddress;
    }

    public void setToAddress(List<String> toAddress) {
        this.toAddress = toAddress;
    }

    public List<String> getCcAddress() {
        return ccAddress;
    }

    public void setCcAddress(List<String> ccAddress) {
        this.ccAddress = ccAddress;
    }

    public List<String> getBccAddress() {
        return bccAddress;
    }

    public void setBccAddress(List<String> bccAddress) {
        this.bccAddress = bccAddress;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }

    public boolean isValidate() {
        return validate;
    }

    public void setValidate(boolean validate) {
        this.validate = validate;
    }

    public String getMailSubject() {
        return mailSubject;
    }

    public void setMailSubject(String mailSubject) {
        this.mailSubject = mailSubject;
    }

    public String getMailContent() {
        return mailContent;
    }

    public void setMailContent(String mailContent) {
        this.mailContent = mailContent;
    }

    public List<String> getAttachFileNames() {
        return attachFileNames;
    }

    public void setAttachFileNames(List<String> attachFileNames) {
        this.attachFileNames = attachFileNames;
    }

    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    public List<String> getAttachImageNames() {
        return attachImageNames;
    }

    public void setAttachImageNames(List<String> attachImageNames) {
        this.attachImageNames = attachImageNames;
    }
}
